import 'package:boss/textStyle/text_style.dart';
import 'package:boss/ui/page/personalSettings/model/list_title_bean.dart';
import 'package:boss/ui/widget/image/base_image.dart';
import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';

class PersonalSettingListTitle extends StatelessWidget {
  final ListTitleBean data;
  final VoidCallback onTap;
  final bool isRedDot;

  const PersonalSettingListTitle({
    Key key,
    @required this.data,
    this.onTap,
    this.isRedDot = false,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    double iconSize = 40.w;
    return GestureDetector(
      onTap: onTap,
      behavior: HitTestBehavior.translucent,
      child: Container(
        height: 110.w,
        padding: EdgeInsets.symmetric(
          horizontal: 20.w,
        ),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: <Widget>[
            Row(
              children: <Widget>[
                data.icon == null
                    ? Container()
                    : BaseImage(
                        data.icon,
                        width: iconSize,
                        height: iconSize,
                      ),
                Container(
                  margin: EdgeInsets.only(
                    left: 22.w,
                  ),
                  child: Text(
                    data.title,
                    style: TextStyleConstant().normal_1_30,
                  ),
                ),
              ],
            ),
            Row(
              children: <Widget>[
                if (isRedDot)
                  Container(
                    width: 10.w,
                    height: 10.w,
                    margin: EdgeInsets.only(
                      right: 5.w,
                    ),
                    decoration: BoxDecoration(
                      shape: BoxShape.circle,
                      color: Colors.red,
                    ),
                  ),
                if (data.value != null)
                  Container(
                    margin: EdgeInsets.only(
                      right: 10.w,
                    ),
                    child: Text(
                      data.value,
                      style: TextStyleConstant().normal_2_26,
                    ),
                  ),
                BaseImage(
                  'assets/image/arrow_right_icon.png',
                  width: 13.w,
                  height: 30.w,
                  fit: BoxFit.contain,
                ),
              ],
            ),
          ],
        ),
      ),
    );
  }
}
